Skip to content

Fixes php 8.4 deprecation warnings like: "Implicitly marking paramete… #607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 9, 2025

Conversation

julesgraus
Copy link
Contributor

Fixes php 8.4 deprecation warnings like: "Implicitly marking parameter ... as nullable is deprecated, the explicit nullable type must be used instead in ..."

Example Warning: PHP Deprecated: Kalnoy\Nestedset\NodeTrait::create(): Implicitly marking parameter $parent as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/vendor/kalnoy/nestedset/src/NodeTrait.php on line 754

And fixes "Class "Laravel\SerializableClosure\Support\ReflectionClosure" not found" when running the tests.

I've discovered more issues with php docblocks that can be fixed in different ways, but i wanted to keep this pull request as small as possible.

…r ... as nullable is deprecated, the explicit nullable type must be used instead in ..."

Example Warning: PHP Deprecated:  Kalnoy\Nestedset\NodeTrait::create(): Implicitly marking parameter $parent as nullable is deprecated, the explicit nullable type must be used instead in /var/www/html/vendor/kalnoy/nestedset/src/NodeTrait.php on line 754

And fixes "Class "Laravel\SerializableClosure\Support\ReflectionClosure" not found" when running the tests.
@it-can
Copy link

it-can commented Dec 23, 2024

@lazychaser Can this be merged?

@it-can
Copy link

it-can commented Jan 5, 2025

@lazychaser can you take a look?

@kohlerdominik kohlerdominik mentioned this pull request Feb 24, 2025
@it-can
Copy link

it-can commented Mar 12, 2025

@lazychaser can you merge this?

@it-can
Copy link

it-can commented Mar 19, 2025

@lazychaser can you take a look please?

@julesgraus
Copy link
Contributor Author

If you could have a look it would be nice. The changelog isn’t that big as I see it.

@kohlerdominik
Copy link
Contributor

@julesgraus you might want to rebase the branch because the L12 compatibility was merged.

Maybe then @jonnott would have a second to look at it.

@julesgraus
Copy link
Contributor Author

Done

Fix quote problem due to incorrect rebase / merge
@jonnott jonnott merged commit 75f428e into lazychaser:v6 Apr 9, 2025
2 checks passed
@jonnott
Copy link
Collaborator

jonnott commented Apr 9, 2025

@julesgraus Do you think putting this out as v6.1.0 would be a good plan?

@jonnott
Copy link
Collaborator

jonnott commented Apr 9, 2025

@kohlerdominik
Copy link
Contributor

@jonnott I just looked at the PR you merged, and because there are also signature changes involved (some methods are now typed that weren't before), technically, 7.0.0 release would actually be correct.

For example this change:
newNestedSetQuery($table = null)newNestedSetQuery(?string $table = null)

Means, that if in case somebody passed a table name as int instead of string, they'd now get a TypeError (a little far fetched, but still valid). And that's why it's required to be marked as Major release, which expresses that there are breaking changes in the API (method signatures).

Another way is to specifically revert the changes where no type was declared before, and keep the other fixes fixing the deprecations. This would allow 6.1.0 release.

@jonnott
Copy link
Collaborator

jonnott commented Apr 9, 2025

@jonnott I just looked at the PR you merged, and because there are also signature changes involved (some methods are now typed that weren't before), technically, 7.0.0 release would actually be correct.

For example this change: newNestedSetQuery($table = null)newNestedSetQuery(?string $table = null)

Means, that if in case somebody passed a table name as int instead of string, they'd now get a TypeError (a little far fetched, but still valid). And that's why it's required to be marked as Major release, which expresses that there are breaking changes in the API (method signatures).

Another way is to specifically revert the changes where no type was declared before, and keep the other fixes fixing the deprecations. This would allow 6.1.0 release.

@julesgraus Thoughts on what @kohlerdominik says?

@julesgraus
Copy link
Contributor Author

julesgraus commented Apr 9, 2025

I am not using or near a computer at the moment. Technically what @kohlerdominik says is true and valid. But the docblocks above the methods already said that you need to pass in strings or null.

So yeah, the signature has changed and it now throws type errors, but you have been warned before by the docblock if you used it in a wrong way.

And most importantly: it probable did not work anyway if you used the methods wrong. Regardless if this technically is a breaking change, the user had his app in a broken state already if he did use the methods wrong.

So @kohlerdominik is right. But even though, without looking into it any further, I do not think it’s a problem for the users of the package.

what about versioning? If we could agree for now that it isn’t a major change, it would be a patch release I guess (the last number in the version needs to increment). Because it’s not a feature (middle number of the version.

If you guys decide that it must be a major release anyways, let me know. I can apply the changes on a version 7 branch for example. Just let me know.

@jonnott
Copy link
Collaborator

jonnott commented Apr 10, 2025

I think it could be a minor release then - i.e. 6.1.0. It's not a breaking change technically as you say, as if you weren't adhering to the correct types on these methods, your app would be broken anyway.

@julesgraus
Copy link
Contributor Author

julesgraus commented Apr 10, 2025

Yes, I agree 👍

@jonnott
Copy link
Collaborator

jonnott commented Apr 10, 2025

Ok. I have the privileges to tag a new version, but I'm worried about breaking peoples' apps by getting anything wrong which introduces a BC break. Thoughts appreciated..

@kohlerdominik
Copy link
Contributor

@jonnott when merging #619 you'd get these changes between 6.0.5 and the next release: v6.0.5...ysfks:laravel-nestedset:fix/php84-warnings

Allowing the next release to be 6.0.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants